package com.systop.scos.diary.diaryType.webapp;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.systop.core.webapp.struts2.action.DefaultCrudAction;
import com.systop.scos.diary.diaryType.model.DiaryType;
import com.systop.scos.diary.diaryType.service.DiaryTypeManager;
/**
 * 日志类别action
 * @author yj
 *
 */
@SuppressWarnings("serial")
@Controller
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class DiaryTypeAction extends
		DefaultCrudAction<DiaryType, DiaryTypeManager> {
	/**
	 * 保存日志类别
	 */
	public String save() {
		// 判断是否有重复名称
		if (getManager().getDao().exists(getModel(), "name")) {
			addActionError("类别名称已存在！");
			return INPUT;
		}
		return super.save();
	}
}
